#ifndef _CCHART3DSERIES_H_
#define _CCHART3DSERIES_H_

#include <buola/chart.h>

#include <buola/image/ccolor.h>
#include <buola/mat.h>

namespace buola { namespace chart {

class C3DSeries : public UShared
{
public:
    template<typename tXArray,typename tYArray,typename tZArray>
    C3DSeries(const tXArray &pXArray,const tYArray &pYArray,
                        const tZArray &pZArray,int pRows,int pCols)
        :   mRows(pRows),
            mCols(pCols)
    {
        int lLength=pRows*pCols;
        mXData.resize(lLength);
        mYData.resize(lLength);
        mZData.resize(lLength);
        
        for(int i=0;i<lLength;i++)
        {
            mXData[i]=pXArray[i];
            mYData[i]=pYArray[i];
            mZData[i]=pZArray[i];
        }
        
        CalcSeries();
    }
    
    void CalcSeries();

    int GetRows()       {   return mRows;           }
    int GetCols()       {   return mCols;           }
    double GetX(int r,int c)    {   return mXData[r*mCols+c];           }
    double GetY(int r,int c)    {   return mYData[r*mCols+c];           }
    double GetZ(int r,int c)    {   return mZData[r*mCols+c];           }

    std::vector<double> mXData;
    std::vector<double> mYData;
    std::vector<double> mZData;

    mat::CVec3d mMin;
    mat::CVec3d mMinPos;
    mat::CVec3d mMax;

    int mRows;
    int mCols;

    std::wstring mName;
    img::CColor mColor;
};

/*namespace chart*/ } /*namespace buola*/ }

#endif
